/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Berekenen;

import Jama.Matrix;

/**
 *
 * @author Memet
 */
public class Check {
    public static DetCheckResult positiveDef(double e1, double e2, double e3, double nu12, double nu23, double nu31, double g12, double g23, double g31)
    {
        DetCheckResult check = new DetCheckResult();
        Matrix det = new Matrix(6, 6);
        det.set(0, 0, 1/e1);
        det.set(0, 1, (-nu12)/e1);
        det.set(0, 2, (-nu31)/e1);

        det.set(1, 0, (-nu12)/e1);
        det.set(1, 1, 1/e2);
        det.set(1, 2, (-nu31)/e2);

        det.set(2, 0, (-nu31)/e1);
        det.set(2, 0, (-nu12)/e2);
        det.set(2, 2, 1/e3);

        det.set(3, 3, 1/g12);
        det.set(4, 4, 1/g23);
        det.set(5, 5, 1/g31);

        int rij=6;
        int kol=6; //% aantal rijen en kolommen
        for(int i=0;i<rij;i++)
        {
            for(int j=i;j<kol;j++)
            {
                Matrix od=det.getMatrix(i, j, i, j); //% dus weer elke submatrix bepalen
                double detod=od.det(); //% determinant bepalen

                if(!(detod>0))
                {
                    check = new DetCheckResult(i, j, i, j);
                    break;
                }

            }
            if(!check.isSucces())
            {
                break;
            }
        }

        return check;
    }
}